package com.exam.online.system.dao;

import com.exam.online.system.entity.Question;
import com.exam.online.system.entity.QuestionStuPaper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface QuestionDAO {
    int deleteByPrimaryKey(Integer id);

    int insert(Question record);

    int insertSelective(Question record);

    Question selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Question record);

    int updateByPrimaryKey(Question record);

    /**
     * 通过课程id和题目类型查找题目
     *
     * @param courseId
     * @param questionType
     * @return List<Question>
     */
    @Select("select * from `t_question` where type=#{questionType} and course_id=#{courseId}")
    List<Question> selectByCourseIdAndType(@Param("courseId") Integer courseId, @Param("questionType") Integer questionType);


    @Select("select * from `t_question` limit #{pageNo},#{pageSize} ")
    List<Question> getAllQuestion(@Param("pageNo")Integer pageNo,@Param("pageSize")Integer pageSize);

    @Select("select count(*) from `t_question`  ")
    Integer getAllQuestionCount();
}